<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-code">404</div>
      <div class="error-title">页面不存在</div>
      <div class="error-message">您访问的页面不存在或已被移除</div>
      <div class="error-actions">
        <el-button type="primary" @click="goToHome">
          <el-icon><HomeFilled /></el-icon>
          返回首页
        </el-button>
        <el-button @click="goBack">
          <el-icon><ArrowLeft /></el-icon>
          返回上一页
        </el-button>
      </div>
    </div>
    <div class="error-decoration">
      <div class="decoration-circle circle-1"></div>
      <div class="decoration-circle circle-2"></div>
      <div class="decoration-circle circle-3"></div>
      <div class="decoration-circle circle-4"></div>
    </div>
  </div>
</template>

<script>
import { useRouter } from 'vue'

export default {
  name: 'Error404',
  setup() {
    const router = useRouter()
    
    // 返回首页
    const goToHome = () => {
      router.push('/')
    }
    
    // 返回上一页
    const goBack = () => {
      router.back()
    }
    
    return {
      goToHome,
      goBack
    }
  }
}
</script>

<style scoped>
.error-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #f5f7fa;
  position: relative;
  overflow: hidden;
}

.error-content {
  text-align: center;
  z-index: 1;
  background-color: white;
  padding: 40px 60px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  width: 90%;
  transform: translateY(-20px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(-40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  color: #409eff;
  margin-bottom: 20px;
  line-height: 1;
  position: relative;
  display: inline-block;
}

.error-code::before,
.error-code::after {
  content: '';
  position: absolute;
  width: 80px;
  height: 8px;
  background-color: #409eff;
  border-radius: 4px;
}

.error-code::before {
  top: 30px;
  left: -100px;
  transform: rotate(45deg);
  opacity: 0.6;
}

.error-code::after {
  bottom: 30px;
  right: -100px;
  transform: rotate(-45deg);
  opacity: 0.6;
}

.error-title {
  font-size: 28px;
  color: #303133;
  margin-bottom: 16px;
  font-weight: 600;
}

.error-message {
  font-size: 16px;
  color: #606266;
  margin-bottom: 32px;
  line-height: 1.5;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
}

.error-actions .el-button {
  min-width: 120px;
  font-size: 16px;
  padding: 10px 20px;
  transition: all 0.3s ease;
}

.error-actions .el-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.3);
}

/* 装饰元素 */
.error-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.decoration-circle {
  position: absolute;
  border-radius: 50%;
  background-color: rgba(64, 158, 255, 0.1);
}

.circle-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation: float 8s ease-in-out infinite;
}

.circle-2 {
  width: 200px;
  height: 200px;
  top: 40%;
  right: -80px;
  animation: float 6s ease-in-out infinite 2s;
}

.circle-3 {
  width: 150px;
  height: 150px;
  bottom: -50px;
  left: 30%;
  animation: float 7s ease-in-out infinite 1s;
}

.circle-4 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  right: 20%;
  animation: float 5s ease-in-out infinite 3s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(20px, -20px);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .error-content {
    padding: 30px 40px;
    margin: 0 20px;
  }
  
  .error-code {
    font-size: 80px;
  }
  
  .error-code::before,
  .error-code::after {
    width: 50px;
    height: 6px;
  }
  
  .error-code::before {
    top: 20px;
    left: -70px;
  }
  
  .error-code::after {
    bottom: 20px;
    right: -70px;
  }
  
  .error-title {
    font-size: 24px;
  }
  
  .error-message {
    font-size: 14px;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .error-actions .el-button {
    width: 100%;
  }
  
  .circle-1 {
    width: 200px;
    height: 200px;
  }
  
  .circle-2 {
    width: 150px;
    height: 150px;
  }
  
  .circle-3 {
    width: 100px;
    height: 100px;
  }
  
  .circle-4 {
    width: 80px;
    height: 80px;
  }
}

@media (max-width: 480px) {
  .error-content {
    padding: 20px 30px;
  }
  
  .error-code {
    font-size: 60px;
  }
  
  .error-code::before,
  .error-code::after {
    display: none;
  }
  
  .error-title {
    font-size: 20px;
  }
}
</style>